home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Plus 2002 #11
/
Amiga Plus CD - 2002 - No. 11.iso
/
Tools
/
Freeware
/
DiskMaster
/
Rexx
/
DMDirLevel.rexx
< prev
next >
Wrap
OS/2 REXX Batch file
|
2002-10-27
|
2KB
|
75 lines
/* $VER: DMDirLevel.rexx 1.0 (30.3.98) by J. Tierney
DiskMaster II Directory Level v1.0
3/30/98 J. Tierney <jtierney@cyberlink-inc.com>
Purpose: Jumps to a directory level.
Usage: Rexx DMDirLevel.rexx <window S|D|N> [<level>]
<window> - Window to display the directory in:
S = Source.
D = Destination.
N = New window.
<level> - Directory level to jump to. 0 = root.
If not specified, a requester will pop up asking for the
level.
Example:
Current path = "Games:PAL_Games/Worms/TWCUSTOM"
Dir. level 0 = "Games:"
Dir. level 1 = "Games:PAL_Games"
Dir. level 9 = "Games:PAL_Games/Worms/TWCUSTOM" (No change.)
*/
/* Dimensions for the new window. */
/* Change these to suit yourself. */
winx = 100 /* X */
winy = 8 /* Y */
winw = 260 /* Width */
winh = 194 /* Height */
OPTIONS RESULTS
ARG dest lvl
IF lvl = '' THEN DO
'CONFIRM "Dir. level (0 = Root):", Okay Cancel 1'
IF rc = 1 THEN EXIT 0
lvl = STRIP(result, 'B')
END
IF dest = '' THEN dest = 'S'
ELSE dest = LEFT(dest, 1)
'STATUS P'
path = result
IF RIGHT(path, 1) ~= ':' THEN path = path || '/'
pathlen = LENGTH(path)
IF lvl = 0 THEN DO
x = POS(':', path)
IF x > 0 THEN newpath = LEFT(path, x)
END
ELSE DO
fx = 0
DO UNTIL lvl = 0
x = POS('/', path, fx + 1)
IF x > 0 THEN DO
fx = x
lvl = lvl - 1
END
ELSE lvl = 0
END
IF fx > 0 THEN newpath = LEFT(path, fx)
END
IF (dest = 'S') & (newpath = path) THEN EXIT 0
IF dest = 'N' THEN DO
'OPENWINDOW' winx winy winw winh newpath
EXIT 0
END
IF (dest = 'D') THEN 'WINDOW DEST'
'NEWDIR' newpath
IF dest ~= 'S' THEN 'WINDOW DEST'